package com.hw.rule;

import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Classname: MySelfRule
 * @Description: Ribbon规则类,因为不能放在@ComponentScan修饰类的文件夹内及其子文件夹下,
 *               所以单独新建文件夹和这个类
 * @Date: 2021/8/8
 * @Author: huwei
 */
@Configuration
public class MySelfRule {

    @Bean
    public IRule getMyRule(){
        // 返回Ribbon的随机规则
        return new RandomRule();
    }
}
